package com.mapull.clone;

import lombok.Data;

/**
 * @author mapull
 */
@Data
public class Student implements Cloneable{

    private String name;

    private Integer age;

    private Address address;

    @Override
    public Student clone() {
        try {
            Student clone = (Student) super.clone();
            // TODO: copy mutable state here, so the clone can't change the internals of the original
            clone.address = address.clone();
            return clone;
        } catch (CloneNotSupportedException e) {
            throw new AssertionError();
        }
    }
}
